package com.itcast.cn.jsp.mapper;

import com.itcast.cn.jsp.pojo.Brand;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * <p>类描述</p>
 *
 * @author hyatt 2022/1/21 15:02
 * @version 1.0
 */
public interface BrandMapper {

    @ResultMap("brandResultMap")
    @Select("select * from tb_brand")
    List<Brand> selectAll();

    @ResultMap("brandResultMap")
    @Insert("insert into tb_brand values(null, #{brandName}, #{companyName}, #{ordered}, #{description}, #{status})")
    void insert(Brand brand);

    @ResultMap("brandResultMap")
    @Update("update tb_brand set brand_name=#{brandName}, company_name=#{companyName}, description=#{description}, status=#{status} where id=#{id}")
    void update(Brand brand);

    @Delete("delete from tb_brand where id = #{id}")
    void delete(@Param("id") int id);

    @ResultMap("brandResultMap")
    @Select("select * from tb_brand where id=#{id}")
    Brand selectById(@Param("id") int id);

}
